package com.molin.ArrayTest;

import java.util.Scanner;

public class Demo6Array {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("pls input a num: ");
        int num = sc.nextInt();

        int x = -1;
        int arr[] = {45, 99, 89, 12, 1239, 951};
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]) {
                x = i;
            }
        }
        if (x == -1) {
            System.out.println("Sry,can't find array's index.");
        } else {
            System.out.println("Array's index is: " + x);
        }
    }
}
